{% extends "base.html" %}
{% block content %}	
<br />
{% if selects|length == 0 %}
	{% include 'include/getstarted.html' %}
{% else %}
<form style="padding-left: 5px;" action="viewsttats.py" method="post">
	<input type="hidden" id="service" value="{{service}}" />
	<select autofocus required name="serv" id="serv">
		<option disabled>Choose server</option>
			{% for select in selects %}
				{% if select.2 == serv %}
					<option value="{{ select.2 }}" selected>{{ select.1 }}</option>
				{% else %}
					<option value="{{ select.2 }}">{{ select.1 }}</option>
				{% endif %}
			{% endfor %}
	</select>		
	<a class="ui-button ui-widget ui-corner-all" id="show" title="Show stats" onclick="{{ onclick }}">Show</a>
</form>
<br />
<div id="ajax" style="margin-left: 5px; margin-right: 5px;"></div>
	<div id="notice" style="padding-left: 15px; font-size: 25px;">
		Please choose a server
	</div>	
<script> 
	if (cur_url[1]) {
		showStats();		
	}	
	async function wait() {
		$('form').append('<input type="hidden" name="serv" value='+$("#serv").val()+'>');
		$('form').append('<input type="hidden" name="token" value='+$('#token').val()+'>');
		$( "input[type=submit], button" ).button();
		$('#notice').hide();
		$('li').css('margin-top', '0');
		$('li').css('width', '207px	');
		$('li').css('padding', '0px');
		$('li').css('margin', '0px');
		$('.menu li ul li').css('width', '227px');
		$('.menu li ul li').css('margin-left', '-20px');		
		$('th').css('background-color', '#f5faf4');
		$('table.tbl th.pxname').css('background-color', '#5d9ceb');
		$('.v_menu').css('left', '200px');		
		$('table.tbl th.pxname').css('width', '100%');
		$('a.px:link').css('color', '#fff');
		$('td').css('font-size', '11');
		$('h1').css('display', 'none');
		$('td').css('border-color', '#ddd');
		$('td').css('padding', '3px');
		$('th').css('padding-top', '4px');
		$('th').css('padding-bottom', '4px');
		$('th').css('border-color', '#ddd');
		$('h1').next().css('display', 'none');	  
		$('h1').next().next().css('display', 'none');	  
		$('h1').next().next().next().css('display', 'none');	  
		$('h1').next().next().next().next().css('display', 'none');	  
		$('body').css('font-family', '-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol');	  
		$( "select" ).selectmenu();
		{% if role == 3 %}
			$('input[type=checkbox]').remove()	
		{% endif %}
		await sleep(2000);
	  
	  $("form").submit(function() {
		$.ajax({
			type: "get",
			url: "options.py",
			dataType: "text",
			data: $(this).serialize(),
			success: function( data ) {
				showStats();
				}
			});
		return false;
		});		
	}
	$('#serv').on('selectmenuchange',function() {
		showStats();		
	});		
</script>
<link href="/inc/style.css" rel="stylesheet">
{% endif %}
{% endblock %}